package com.example.springboot_demo.order;

/**
 * @BelongsProject: springboot_demo
 * @BelongsPackage: com.example.springboot_demo.order
 * @Author: 江岸
 * @CreateTime: 2021-06-06 23:35
 * @Description:
 */
public enum ActionEnum {
    SPRING("spring"),SUMMER("summer"),FALL("fall"),WINTER("winter");

    private final String name;

    private ActionEnum(String name)
    {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public static AbstractSate getStateClassByName(String name){
        if (name.equals(SPRING.name)){
            return new SpringState();
        }
        if (name.equals(SUMMER.name)){
            return new SummerState();
        }
        if (name.equals(FALL.name)){
            return new FallState();
        }
        if (name.equals(WINTER.name)){
            return new WinterState();
        }
        return null;
    }

}
